Einhugur macOS Bridge plugin.

EinhugurMacOSBridge.NSAlert Class (desktop)

A modal dialog or sheet attached to a document window.

The methods of the NSAlert class allow you to specify alert level, alert text, button titles, and a custom icon should you require it.

See also our free X-Platform-Alert on Github which uses the NSAlert on MacOS Systems but gives cross platform experience:
https://github.com/einhugur/X-Platform-Alert

EinhugurCoreBridge.NSObject
   NSAlert

class EinhugurMacOSBridge.NSAlert

Constructors

NSAlertDefault constructor with no parameters.

Properties

AccessoryViewSets or gets the alert’s accessory view.
AlertStyleIndicates the alert’s severity level.
ButtonsThe array of response buttons for the alert.
ClassName (Inherited) (desktop - console) Returns the name of the Cocoa class under the hood as String.
Handle (Inherited) Returns Integer handle to the native NSObject structure.
IconThe custom icon displayed in the alert.
InformativeTextThe alert’s informative text.
MessageTextThe alert’s message text or title.
ShowsSuppressionButtonSpecifies whether the alert includes a suppression checkbox, which you can employ to allow a user to opt out of seeing the alert again.
SuppressionButtonThe alert’s suppression checkbox.

Methods

AddButtonWithTitleAdds a button with a given title to the alert.
BeginSheetModalForWindowRuns the alert modally as a sheet attached to the specified window. This variation takes new style Xojo DesktopWindow.
BeginSheetModalForWindowRuns the alert modally as a sheet attached to the specified window. This variation takes old style Xojo Window.
shared CastDoes deep cast on incoming NSObject to NSAlert
Release (Inherited) Releases the NSObject.
Retain (Inherited) Retains the NSObject
RunModalRuns the alert as an app-modal dialog and returns the constant that identifies the button clicked.

Delegates

AlertCompletionDelegateDelegate to get callback when showing the NSAlert modal only to one window.

Enumerations

StyleValuesEnum representing styles for NSAlert.

Constants

Version = 5.0 (Inherited)

Examples


using EinhugurMacOSBridge

var alert as NSAlert = new NSAlert()

alert.MessageText = "Some alert"
alert.InformativeText = "This is a test alert"

call alert.AddButtonWithTitle("Do Something")

// Putting destructive action, makes the button have additional warning indicator on Big Sur
alert.AddButtonWithTitle("Delete something").HasDestructiveAction = true
call alert.AddButtonWithTitle("Cancel")

var result as Integer = alert.RunModal()

select case result
   case 1000
    // React to the Do something command
   
   case 1001
    // React to the Delete something command
   
   case 1002
    // React to the Cancel command
   
end select

Supported Platforms:

  • macOS Intel 64 bit
  • macOS Apple Silicon
  • Unsupported Platforms:

  • Windows 32 bit
  • Windows 64 bit
  • Windows ARM 64 bit
  • Linux 32 bit
  • Linux 64 bit
  • Linux ARM 32 bit
  • Linux ARM 64 bit